package com.xjy.service;

import com.github.pagehelper.PageHelper;
import com.xjy.dao.orderMapper;
import com.xjy.pojo.Comment;
import com.xjy.pojo.Message;
import com.xjy.pojo.Order;
import com.xjy.pojo.OrderInfo;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class orderServiceImpl implements orderService{
    private orderMapper orderMapper;

    public void setOrderMapper(com.xjy.dao.orderMapper orderMapper) {
        this.orderMapper = orderMapper;
    }


    @Override
    public List<Order> getOrdersByUser(int uid) {
        return orderMapper.getOrdersByUser(uid);
    }

    @Override
    public List<Map> getOrders() {
        return orderMapper.getOrders();
    }

    @Override
    public int addOrder(Order order) {
        return orderMapper.addOrder(order);
    }

    @Override
    public int cancelOrder(String oid) {
        return orderMapper.cancelOrder(oid);
    }

    @Override
    public int updateOrder(String oid,int status) {
        return orderMapper.updateOrder(oid,status);
    }

    @Override
    public Order getOrderById(String oid) {
        return orderMapper.getOrderById(oid);
    }

    @Override
    public List<OrderInfo> getOrderInfos(String oid) {
        return orderMapper.getOrderInfos(oid);
    }

    @Override
    public int addOrderInfo(OrderInfo orderInfo) {
        return orderMapper.addOrderInfo(orderInfo);
    }

    @Override
    public int updateOrderInfo(OrderInfo orderInfo) {
        return orderMapper.updateOrderInfo(orderInfo);
    }

    @Override
    public OrderInfo getOrderInfoById(String orid) {
        return orderMapper.getOrderInfoById(orid);
    }

    @Override
    public List<Map> getOrdersByUid(int uid) {
        return orderMapper.getOrdersByUid(uid);
    }

    @Override
    public int deleteOrder(String oid) {
        return orderMapper.deleteOrder(oid);
    }

    @Override
    public int deleteOrderInfo(String oid) {
        return orderMapper.deleteOrderInfo(oid);
    }

    @Override
    public Comment getComment(String oid) {
        return orderMapper.getComment(oid);
    }

    @Override
    public int addComment(Comment comment) {
        return orderMapper.addComment(comment);
    }

    @Override
    public int deleteComment(String oid) {
        return orderMapper.deleteComment(oid);
    }

    @Override
    public int updateComment(Map map) {
        return orderMapper.updateComment(map);
    }

    @Override
    public int addPics(String picid, String fileName) {
        return orderMapper.addPics(picid, fileName);
    }

    @Override
    public int updatePics(Map<String, String> map) {
        return orderMapper.updatePics(map);
    }

    @Override
    public int deletePics(String picid) {
        return orderMapper.deletePics(picid);
    }

    @Override
    public int addCommPic(String picid, String fileName) {
        return orderMapper.addPics(picid,fileName);
    }

    @Override
    public String getOidByPicid(String picid) {
        return orderMapper.getOidByPicid(picid);
    }

    @Override
    public List<Map> getOrderByStatus(int status, int page, int size) {
        PageHelper.startPage(page, size);
        return orderMapper.getOrderByStatus(status);
    }

    @Override
    public List<Map> getComments(int page, int size) {
        System.out.println("comments======>"+orderMapper.getComments());
        PageHelper.startPage(page, size);
        return orderMapper.getComments();
    }

    @Override
    public int updateReply(String oid, String reply) {
        return orderMapper.updateReply(oid, reply);
    }

    @Override
    public int getUidByOid(String oid) {
        return orderMapper.getUidByOid(oid);
    }




}
